aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PscIde.js
diff options
context:
space:
mode:
authoreric <thul.eric@gmail.com>2017-02-25 10:30:44 -0500
committerGitHub <noreply@github.com>2017-02-25 10:30:44 -0500
commit936a04b591f649dbff2a65bbbd291913fc42502d (patch)
treeb426fce8d295591d60ce94c54a157a324e100ffb /src/PscIde.js
parenta3c358f80f8197d5a1d05e42916cd5593b5b2dd5 (diff)
parent806d2915e6579d3dce38de8f2b40b85466ceda05 (diff)
downloadpurs-loader-936a04b591f649dbff2a65bbbd291913fc42502d.tar.gz
purs-loader-936a04b591f649dbff2a65bbbd291913fc42502d.tar.zst
purs-loader-936a04b591f649dbff2a65bbbd291913fc42502d.zip
Merge pull request #84 from ethul/topic/error-handling
Topic/error handling
Diffstat (limited to 'src/PscIde.js')
-rw-r--r--src/PscIde.js23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/PscIde.js b/src/PscIde.js
index 8a0e823..b164dc2 100644
--- a/src/PscIde.js
+++ b/src/PscIde.js
@@ -63,15 +63,28 @@ function connect(psModule) {
63 63
64 const serverArgs = dargs(Object.assign({ 64 const serverArgs = dargs(Object.assign({
65 outputDirectory: options.output, 65 outputDirectory: options.output,
66 "_": options.src 66 '_': options.src
67 }, options.pscIdeServerArgs)) 67 }, options.pscIdeServerArgs))
68 68
69 debug('attempting to start psc-ide-server', serverArgs) 69 debug('attempting to start psc-ide-server', serverArgs)
70 70
71 const ideServer = cache.ideServer = spawn('psc-ide-server', serverArgs) 71 const ideServer = cache.ideServer = spawn('psc-ide-server', serverArgs)
72
73 ideServer.stdout.on('data', data => {
74 debug('psc-ide-server stdout: %s', data.toString());
75 });
76
72 ideServer.stderr.on('data', data => { 77 ideServer.stderr.on('data', data => {
73 debug(data.toString()) 78 debug('psc-ide-server stderr: %s', data.toString());
74 }) 79 });
80
81 ideServer.on('error', error => {
82 debug('psc-ide-server error: %o', error);
83 });
84
85 ideServer.on('close', (code, signal) => {
86 debug('psc-ide-server close: %s %s', code, signal);
87 });
75 88
76 return retryPromise((retry, number) => { 89 return retryPromise((retry, number) => {
77 return connect_().catch(error => { 90 return connect_().catch(error => {
@@ -150,7 +163,7 @@ function rebuild(psModule) {
150 debug('unknown module, attempting full recompile') 163 debug('unknown module, attempting full recompile')
151 return Psc.compile(psModule) 164 return Psc.compile(psModule)
152 .then(() => PsModuleMap.makeMap(options.src).then(map => { 165 .then(() => PsModuleMap.makeMap(options.src).then(map => {
153 debug('rebuilt module map'); 166 debug('rebuilt module map after unknown module forced a recompile');
154 cache.psModuleMap = map; 167 cache.psModuleMap = map;
155 })) 168 }))
156 .then(() => request({ command: 'load' })) 169 .then(() => request({ command: 'load' }))
@@ -172,6 +185,8 @@ function rebuild(psModule) {
172 }) 185 })
173 }) 186 })
174 187
188 debug('psc-ide-client stdin: %o', body);
189
175 ideClient.stdin.write(JSON.stringify(body)) 190 ideClient.stdin.write(JSON.stringify(body))
176 ideClient.stdin.write('\n') 191 ideClient.stdin.write('\n')
177 }) 192 })