Browse Source

use -S when passing command to env to ensure args passed correctly

pull/331/head
butlerx 4 years ago
parent
commit
cf736b7739
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 2
      src/server.ts
  2. 4
      src/server/spawn.ts

2
src/server.ts

@ -61,7 +61,7 @@ export async function start(
args[1] = `${username.trim()}@${args[1]}`;
logger.debug('Spawning term', {
username: username.trim(),
cmd: args.join(' ').trim(),
cmd: args.join(' '),
});
spawn(socket, args);
} catch (error) {

4
src/server/spawn.ts

@ -5,7 +5,9 @@ import { logger } from '../shared/logger.js';
import { xterm } from './shared/xterm.js';
export function spawn(socket: SocketIO.Socket, args: string[]): void {
const term = pty.spawn('/usr/bin/env', args, xterm);
const cmd = ['-S', ...args];
logger.debug('Spawning PTTY', { cmd });
const term = pty.spawn('/usr/bin/env', cmd, xterm);
const { pid } = term;
const address = args[0] === 'ssh' ? args[1] : 'localhost';
logger.info('Process Started on behalf of user', {

Loading…
Cancel
Save