Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/runtime/LocalRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { EXIT_CODE_ABORTED, EXIT_CODE_TIMEOUT } from "../constants/exitCodes";
import { listLocalBranches } from "../git";
import { checkInitHookExists, getInitHookPath, createLineBufferedLoggers } from "./initHook";
import { execAsync } from "../utils/disposableExec";
import { findBashPath, findNicePath } from "./executablePaths";
import { getProjectName } from "../utils/runtime/helpers";
import { getErrorMessage } from "../utils/errors";

Expand Down Expand Up @@ -53,12 +52,9 @@ export class LocalRuntime implements Runtime {
);
}

// Find bash path (important for CI environments where PATH may not be set)
const bashPath = findBashPath();
const nicePath = findNicePath();

// If niceness is specified, spawn nice directly to avoid escaping issues
const spawnCommand = options.niceness !== undefined ? nicePath : bashPath;
const spawnCommand = options.niceness !== undefined ? "nice" : "bash";
const bashPath = "bash";
const spawnArgs =
options.niceness !== undefined
? ["-n", options.niceness.toString(), bashPath, "-c", command]
Expand Down Expand Up @@ -328,19 +324,21 @@ export class LocalRuntime implements Runtime {

// Create parent directory if needed
const parentDir = path.dirname(workspacePath);
// eslint-disable-next-line local/no-sync-fs-methods
if (!fs.existsSync(parentDir)) {
// eslint-disable-next-line local/no-sync-fs-methods
fs.mkdirSync(parentDir, { recursive: true });
try {
await fsPromises.access(parentDir);
} catch {
await fsPromises.mkdir(parentDir, { recursive: true });
}

// Check if workspace already exists
// eslint-disable-next-line local/no-sync-fs-methods
if (fs.existsSync(workspacePath)) {
try {
await fsPromises.access(workspacePath);
return {
success: false,
error: `Workspace already exists at ${workspacePath}`,
};
} catch {
// Workspace doesn't exist, proceed with creation
}

// Check if branch exists locally
Expand Down Expand Up @@ -419,8 +417,7 @@ export class LocalRuntime implements Runtime {
const loggers = createLineBufferedLoggers(initLogger);

return new Promise<void>((resolve) => {
const bashPath = findBashPath();
const proc = spawn(bashPath, ["-c", `"${hookPath}"`], {
const proc = spawn("bash", ["-c", `"${hookPath}"`], {
cwd: workspacePath,
stdio: ["ignore", "pipe", "pipe"],
});
Expand Down
4 changes: 1 addition & 3 deletions src/runtime/SSHRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { log } from "../services/log";
import { checkInitHookExists, createLineBufferedLoggers } from "./initHook";
import { streamProcessToLogger } from "./streamProcess";
import { expandTildeForSSH, cdCommandForSSH } from "./tildeExpansion";
import { findBashPath } from "./executablePaths";
import { getProjectName } from "../utils/runtime/helpers";
import { getErrorMessage } from "../utils/errors";
import { execAsync } from "../utils/disposableExec";
Expand Down Expand Up @@ -432,8 +431,7 @@ export class SSHRuntime implements Runtime {
const command = `cd ${shescape.quote(projectPath)} && git bundle create - --all | ssh ${sshArgs.join(" ")} "cat > ${bundleTempPath}"`;

log.debug(`Creating bundle: ${command}`);
const bashPath = findBashPath();
const proc = spawn(bashPath, ["-c", command]);
const proc = spawn("bash", ["-c", command]);

streamProcessToLogger(proc, initLogger, {
logStdout: false,
Expand Down
57 changes: 0 additions & 57 deletions src/runtime/executablePaths.ts

This file was deleted.