Skip to content

fix(session): chain the working directory with && instead of ; - #78

Merged
julienj merged 1 commit into
automatephp:mainfrom
loicsapone:fix/session-cd-chaining
Aug 8, 2026
Merged

fix(session): chain the working directory with && instead of ;#78
julienj merged 1 commit into
automatephp:mainfrom
loicsapone:fix/session-cd-chaining

Conversation

@loicsapone

Copy link
Copy Markdown
Contributor

Commands were sent as:

sprintf('cd %s; %s', $this->getReleasePath(), $command)

; runs the second command whatever happened to the first. When the release directory
is missing — a cleanup that ran concurrently, a release moved to releases/failed
after an earlier failure — the cd fails but the command still runs, from the home
directory of the SSH user. A hook such as rm -rf var/cache then hits the wrong tree.

Both exec() and execAsync() now use &&.

Tests

Existing assertions updated, plus a case covering execAsync() with a working
directory, which had the same bug and no coverage.

Note

The paths themselves are still interpolated unquoted, here and in
mkdir/mv/rm/symlink/touch. Escaping them is a consistent change of its own
and is deliberately left out of this PR.

@julienj
julienj merged commit 80afe65 into automatephp:main Aug 8, 2026
5 checks passed
@julienj

julienj commented Aug 8, 2026

Copy link
Copy Markdown
Member

Thank @loicsapone

@loicsapone
loicsapone deleted the fix/session-cd-chaining branch August 9, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants