summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler.sml8
-rw-r--r--tests/has space.ur2
-rw-r--r--tests/spacey.ur1
-rw-r--r--tests/spacey.urp3
4 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 6d9c8166..27529251 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -1307,6 +1307,8 @@ val sqlify = {
val toSqlify = transform sqlify "sqlify" o toMono_opt2
+val escapeFilename = String.translate (fn #" " => "\\ " | #"\"" => "\\\"" | #"'" => "\\'" | ch => str ch)
+
fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
let
val proto = Settings.currentProtocol ()
@@ -1318,10 +1320,10 @@ fun compileC {cname, oname, ename, libs, profile, debug, link = link'} =
val compile = "gcc " ^ Config.gccArgs ^ " -Wimplicit -Werror -O3 -fno-inline -I " ^ Config.includ
^ " " ^ #compile proto
- ^ " -c " ^ cname ^ " -o " ^ oname
+ ^ " -c " ^ escapeFilename cname ^ " -o " ^ escapeFilename oname
- val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname
- ^ " -o " ^ ename ^ " " ^ libs
+ val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ escapeFilename oname
+ ^ " -o " ^ escapeFilename ename ^ " " ^ libs
val (compile, link) =
if profile then
diff --git a/tests/has space.ur b/tests/has space.ur
new file mode 100644
index 00000000..4dec8c0c
--- /dev/null
+++ b/tests/has space.ur
@@ -0,0 +1,2 @@
+fun main () : transaction page = return <xml>Hehe</xml>
+
diff --git a/tests/spacey.ur b/tests/spacey.ur
new file mode 100644
index 00000000..22c5e3ae
--- /dev/null
+++ b/tests/spacey.ur
@@ -0,0 +1 @@
+fun main () : transaction page = return <xml/>
diff --git a/tests/spacey.urp b/tests/spacey.urp
new file mode 100644
index 00000000..47ba25cb
--- /dev/null
+++ b/tests/spacey.urp
@@ -0,0 +1,3 @@
+exe has space.exe
+
+spacey