octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #43426] run doesn't return to original working


From: Andreas Weber
Subject: [Octave-bug-tracker] [bug #43426] run doesn't return to original working directory if using relative path
Date: Sat, 18 Oct 2014 15:46:24 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.1.0

Follow-up Comment #3, bug #43426 (project octave):

I think this won't work. The idea is to check if the called script (line 66)
has changed the current working dir and only return to the old pwd (=wd) is
not.

I would suggest

  wd = pwd ();
  unwind_protect
    cd (d);
    bc_pwd = pwd ();
    evalin ("caller", sprintf ('source ("%s%s");', f, ext),
            "rethrow (lasterror ())");
  unwind_protect_cleanup
    keyboard
    if (strcmp (bc_pwd, pwd ()))
      cd (wd);
    endif
  end_unwind_protect


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?43426>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]