Skip to content

Commit

Permalink
fix(terminal): fix terminal output
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Aug 2, 2017
1 parent 07e988c commit f02d004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/process-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export function startJob(buildId: number, jobId: number): Promise<void> {
.skip(1)
.subscribe(event => {
terminalEvents.next(event);
if (event.data) {
if (event.data && event.type === 'data') {
process.log.push(event.data);
procs[procIndex] = process;
jobProcesses.next(procs);
Expand Down
5 changes: 3 additions & 2 deletions src/api/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export function startBuildProcess(buildId: number, jobId: number,

function executeInContainer(name: string, command: string, vars = []): Observable<ProcessOutput> {
return new Observable(observer => {
const args = ['exec', '--privileged', '-it']
const args = ['exec', '--privileged']
.concat(command.startsWith('sudo') ? '-i' : '-it')
.concat(vars)
.concat(name, 'bash', '-l', '-c', `'${command}'`);
const process = pty.spawn('docker', [args.join(' ')], { shell: true });
Expand All @@ -72,7 +73,7 @@ function executeInContainer(name: string, command: string, vars = []): Observabl

function startContainer(name: string, image: string): Observable<ProcessOutput> {
return new Observable(observer => {
const args = ['run', '--privileged', '-dit', '--name', name, image];
const args = ['run', '--privileged', '-di', '--name', name, image];
const process = pty.spawn('docker', args);

process.on('exit', exitCode => {
Expand Down

0 comments on commit f02d004

Please sign in to comment.