FAQ
Hi,
I'm interested to know if it's possible directly from Node to change the
directory of the current user of the shell, ex:

$ pwd
/Users/marco
$ node cdnode.js /Users/test
$ pwd
/User/test

Currently a nodejs script run in a child process of the shell, all command
issued to the process, like chdir, are reflected only on the subprocess of
node, and not on the main shell process. Thus exiting from the nodejs
script means to return to the previous shell status.

I know that it's possible using the source or dot operator to do this, but
I was interested to know if there are other possibilities to do this
directly inside the nodejs script.

Thanks

Marco

--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Alex Kocharin at Feb 4, 2014 at 2:25 pm
    =A0Yes, it's possible:https://stackoverflow.com/=
    questions/2375003/how-do-i-set-the-working-directory-of-the-parent-process=A0Yes,
    it's possible:https://stackoverflow.com/=
    questions/2375003/how-do-i-set-the-working-directory-of-the-parent-process
  • Marco Vettorello at Feb 5, 2014 at 9:16 pm
    Thanks Alex, but not sure if I will do this ;)

    Il giorno martedì 4 febbraio 2014 15:25:49 UTC+1, Alex Kocharin ha scritto:

    Yes, it's possible:

    https://stackoverflow.com/questions/2375003/how-do-i-set-the-working-directory-of-the-parent-process

    Look at the solution directly below a sentiment "Don't do this". :)


    04.02.2014, 18:05, "Marco Vettorello" <vettorel...@gmail.com <javascript:>
    :
    Hi,
    I'm interested to know if it's possible directly from Node to change the
    directory of the current user of the shell, ex:

    $ pwd
    /Users/marco
    $ node cdnode.js /Users/test
    $ pwd
    /User/test

    Currently a nodejs script run in a child process of the shell, all command
    issued to the process, like chdir, are reflected only on the subprocess of
    node, and not on the main shell process. Thus exiting from the nodejs
    script means to return to the previous shell status.

    I know that it's possible using the source or dot operator to do this, but
    I was interested to know if there are other possibilities to do this
    directly inside the nodejs script.

    Thanks

    Marco


    --
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines:
    https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nod...@googlegroups.com <javascript:>
    To unsubscribe from this group, send email to
    nodejs+un...@googlegroups.com <javascript:>
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

    ---
    You received this message because you are subscribed to the Google Groups
    "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to nodejs+un...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedFeb 4, '14 at 2:04p
activeFeb 5, '14 at 9:16p
posts3
users2
websitenodejs.org
irc#node.js

2 users in discussion

Marco Vettorello: 2 posts Alex Kocharin: 1 post

People

Translate

site design / logo © 2022 Grokbase