【发布时间】:2018-06-19 08:26:30
【问题描述】:
我是 NixOS 的新手,正在尝试使用以下函数从 Haskell 程序调用 emacs:
ediff :: String -> String -> String -> IO ()
ediff testName a b = do
a' <- writeSystemTempFile (testName ++ ".expected") a
b' <- writeSystemTempFile (testName ++ ".received") b
let quote s = "\"" ++ s ++ "\""
callCommand $ "emacs --eval \'(ediff-files " ++ quote a' ++ quote b' ++ ")\'"
当我运行使用stack test 调用此命令的程序时,我得到以下结果(穿插单元测试结果):
/bin/sh: emacs: command not found
Exception: callCommand: emacs --eval '(ediff-files "/run/user/1000/ast1780695788709393584.expected" "/run/user/1000/ast4917054031918502651.received")'
当我从我的 shell 运行无法在上面运行的命令时,它可以完美运行。如何在 NixOS 中从 Haskell 运行进程,就像我直接调用它们一样,以便它们可以访问与我的用户相同的命令和配置?
【问题讨论】: