Skip to content

Commit

Permalink
Fix switching working directory to another drive
Browse files Browse the repository at this point in the history
  • Loading branch information
ferki committed Apr 16, 2023
1 parent b0ad31d commit 4e729a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -4,6 +4,7 @@ Revision history for Rex
[API CHANGES]

[BUG FIXES]
- Fix switching working directory to another drive

[DOCUMENTATION]

Expand Down
4 changes: 3 additions & 1 deletion lib/Rex/Interface/Exec/Local.pm
Expand Up @@ -12,6 +12,7 @@ our $VERSION = '9999.99.99_99'; # VERSION
use Rex::Logger;
use Rex::Commands;

use English qw(-no_match_vars);
use Symbol 'gensym';
use IPC::Open3;
use IO::Select;
Expand Down Expand Up @@ -49,7 +50,8 @@ sub exec {
my ( $out, $err, $pid );

if ( exists $option->{cwd} ) {
$cmd = "cd " . $option->{cwd} . " && $cmd";
my $cd_cmd = $OSNAME eq 'MSWin32' ? 'cd /d' : 'cd';
$cmd = "$cd_cmd " . $option->{cwd} . " && $cmd";
}

if ( exists $option->{path} ) {
Expand Down

0 comments on commit 4e729a6

Please sign in to comment.