diff --git a/src/dlangide/builders/extprocess.d b/src/dlangide/builders/extprocess.d index 021d5f9..69b64a1 100644 --- a/src/dlangide/builders/extprocess.d +++ b/src/dlangide/builders/extprocess.d @@ -297,7 +297,7 @@ class ExternalProcess { params ~= _program; params ~= _args; if (!_stderr) - redirect = Redirect.stdout | Redirect.stderrToStdout; //Redirect.stdin | + redirect = Redirect.stdout | Redirect.stderrToStdout | Redirect.stdin; else redirect = Redirect.all; Log.i("Trying to run program ", _program, " with args ", _args); @@ -393,4 +393,14 @@ class ExternalProcess { } return _state; } + + void write(dstring data) { + if(_state == ExternalProcessState.Error || _state == ExternalProcessState.None || _state == ExternalProcessState.Stopped) { + return; + } + else { + _pipes.stdin.write(data); + _pipes.stdin.close(); + } + } } diff --git a/src/dlangide/tools/d/DCDInterface.d b/src/dlangide/tools/d/DCDInterface.d index 5fb7fc6..19705ce 100644 --- a/src/dlangide/tools/d/DCDInterface.d +++ b/src/dlangide/tools/d/DCDInterface.d @@ -9,12 +9,13 @@ class DCDInterface { this() { dcdProcess = new ExternalProcess(); } - bool execute(char[][] arguments ,ref dstring output) { + bool execute(char[][] arguments ,ref dstring output, dstring input) { ProtectedTextStorage stdoutTarget = new ProtectedTextStorage(); ExternalProcess dcdProcess = new ExternalProcess(); //TODO: Working Directory, where is that? //TODO: Inform user when dcd-client is not available. dcdProcess.run("dcd-client".dup, arguments, "/usr/bin".dup, stdoutTarget); + dcdProcess.write(input); while(dcdProcess.poll() == ExternalProcessState.Running){ } diff --git a/src/dlangide/tools/d/DEditorTool.d b/src/dlangide/tools/d/DEditorTool.d index 62c8271..7e8c5d6 100644 --- a/src/dlangide/tools/d/DEditorTool.d +++ b/src/dlangide/tools/d/DEditorTool.d @@ -28,10 +28,10 @@ class DEditorTool : EditorTool char[][] arguments = ["-l".dup, "-c".dup]; arguments ~= [to!(char[])(byteOffset)]; - arguments ~= [to!(char[])(editor.projectSourceFile.filename())]; + //arguments ~= [to!(char[])(editor.projectSourceFile.filename())]; dstring output; - _dcd.execute(arguments, output); + _dcd.execute(arguments, output, content); string[] outputLines = to!string(output).splitLines(); Log.d("DCD:", outputLines); @@ -70,10 +70,10 @@ class DEditorTool : EditorTool char[][] arguments = ["-c".dup]; arguments ~= [to!(char[])(byteOffset)]; - arguments ~= [to!(char[])(editor.projectSourceFile.filename())]; + //arguments ~= [to!(char[])(editor.projectSourceFile.filename())]; dstring output; - _dcd.execute(arguments, output); + _dcd.execute(arguments, output, content); char[] state = "".dup; dstring[] suggestions;