3
3
// https://opensource.org/licenses/MIT.
4
4
5
5
import { Subject } from 'rxjs' ;
6
+ import { SyncChildProcess } from 'sync-child-process' ;
6
7
7
8
import * as path from 'path' ;
8
9
import {
@@ -20,7 +21,6 @@ import {FunctionRegistry} from '../function-registry';
20
21
import { ImporterRegistry } from '../importer-registry' ;
21
22
import { MessageTransformer } from '../message-transformer' ;
22
23
import { PacketTransformer } from '../packet-transformer' ;
23
- import { SyncProcess } from '../sync-process' ;
24
24
import * as utils from '../utils' ;
25
25
import * as proto from '../vendor/embedded_sass_pb' ;
26
26
import { CompileResult } from '../vendor/sass/compile' ;
@@ -36,7 +36,7 @@ const initFlag = Symbol();
36
36
/** A synchronous wrapper for the embedded Sass compiler */
37
37
export class Compiler {
38
38
/** The underlying process that's being wrapped. */
39
- private readonly process = new SyncProcess (
39
+ private readonly process = new SyncChildProcess (
40
40
compilerCommand [ 0 ] ,
41
41
[ ...compilerCommand . slice ( 1 ) , '--embedded' ] ,
42
42
{
@@ -77,7 +77,12 @@ export class Compiler {
77
77
78
78
/** Yields the next event from the underlying process. */
79
79
private yield ( ) : boolean {
80
- const event = this . process . yield ( ) ;
80
+ const result = this . process . next ( ) ;
81
+ if ( result . done ) {
82
+ this . disposed = true ;
83
+ return false ;
84
+ }
85
+ const event = result . value ;
81
86
switch ( event . type ) {
82
87
case 'stdout' :
83
88
this . stdout$ . next ( event . data ) ;
@@ -86,10 +91,6 @@ export class Compiler {
86
91
case 'stderr' :
87
92
this . stderr$ . next ( event . data ) ;
88
93
return true ;
89
-
90
- case 'exit' :
91
- this . disposed = true ;
92
- return false ;
93
94
}
94
95
}
95
96
0 commit comments