Posts

Showing posts from October 9, 2018

Why does :command argument of make-process not work when string passed as a variable?

Image
Clash Royale CLAN TAG #URR8PPP up vote 1 down vote favorite This works fine: (make-process :name "my-proc2" :buffer " *my-proc2*" :command '("sh" "-c" "echo "hi"nsleep 10necho "there"") :connection-type 'pipe :filter (apply-partially 'my-pass-it-on-filter "/tmp/mytmprealtest")) But if I use a variable like the code below I get Debugger entered--Lisp error: (wrong-type-argument stringp body) : (let ((body "echo "hi"nsleep 10necho "there from var"")) (make-process :name "my-proc2" :buffer " *my-proc2*" :command '("sh" "-c" body) :connection-type 'pipe :filter (apply-partially 'my-pass-it-on-filter "/tmp/mytmprealtest"))) The variable should be a string as well, so why doesn't it work? The documentation for make-process says: ... :command COMMAND -- COMMAND is a list starting with

Swift Async print order?

Image
Clash Royale CLAN TAG #URR8PPP up vote 7 down vote favorite 7 Does this always print in the order of 1 5 2 4 3? print("1") DispatchQueue.main.async print("2") DispatchQueue.main.async print(3) print("4") print("5") I feel the answer is no, but I cannot explain it and hope someone could clarify my understanding. Thank you! swift asynchronous grand-central-dispatch dispatch-async share | improve this question edited 1 hour ago asked 1 hour ago Unikorn 430 1 8 17 1 Yes, it is obvious for 1 ,5 after that it switches to main queue prints 2, Then you again request main queue task but it will not wait for it and prints 4 and then 3 – Prashant Tukadiya 1 hour ago 3 You need to clarify one thing, whether print("1") is executed in the main thread or not. – OOPer 1 hour ago 1 why would it matter? It would always execute first. – Unikorn