[IPython-dev] Bug when launching dos commands
Fernando.Perez at colorado.edu
Thu Oct 27 13:22:35 CDT 2005
Jörgen Stenarson wrote:
> I have found a problem with running dos commands (like dir) when my
> current directory is on a network share (UNC-path(I'm not sure what UNC
> means but cmd.exe complains about it)). The cmd.exe can not use UNC
> paths (paths beginning with \\). What happens is that the cmd.exe can
> not switch to the UNC address and instead ends up on some default
> directory on c:/, which means the command you issued will be performed
> in some other directory than you thought. Could be bad if your doing
> "del *.*"
> So my workaround patches the shell command in genutils to temporarily
> switch the current directory to c: and then appending "pushd unc-path&&"
> to the commandline string that is passed to os.system, and finally
> switch the work dir back to the unc-path. This is done if the os is
> windows and the workdir starts with \\
> This works because "pushd UNC-path" mounts a network drive and then your
> path just becomes x:\.... and is thus not a UNC-path anymore.
> This seems to work for me. But I'm not sure if this is the right place
> or the only place that need to change.
I could certainly use the voice of another win32 expert on helping me evaluate
this. Even though I have a windows box now, I have no network shares to even
test this on, and I don't even know really what the details are. I trust
that you tested it, but I'm a bit worried about applying a patch I don't
understand at all.
At the very least, please keep on testing it for a few days before we apply
it, and if any win32 user can comment on whether what Jorgen did is right or
not, it would be much appreciated.
ps - no tabs in that patch, right ? ;)
More information about the IPython-dev