Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows command from different drive letter fails #16

Closed
corsal opened this issue Jul 14, 2016 · 4 comments
Closed

Windows command from different drive letter fails #16

corsal opened this issue Jul 14, 2016 · 4 comments

Comments

@corsal
Copy link

corsal commented Jul 14, 2016

If my php file is being executed from my E:\ drive to a command running on my C:\ drive, it doesn't work since the cd is happening on the wrong drive.

I fixed it by doing the following:
$drive = substr($command, 0, 2);
$command = sprintf($drive . ' && cd %s && %s', escapeshellarg(dirname($command)), basename($command));

So $command becomes:
C: && cd "C:\Program Files\wkhtmltopdf\bin" && wkhtmltopdf.exe

@mikehaertl
Copy link
Owner

@corsal I've supplied a fix on master. Can you help testing please?

@mikehaertl
Copy link
Owner

@DomiQ As you're also on Windows, maybe you can also confirm that this change doesn't break anything? Also it should work with both, a full path like C:\\foo\bar.exe and a relative path like bar.exe if this is in your search path.

@corsal
Copy link
Author

corsal commented Jul 15, 2016

@mikehaertl Yes, this fix worked great. Thanks!

@mikehaertl
Copy link
Owner

Released 1.2.2 which includes this fix. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants