让阴谋集团保持活力

问题描述

我正在 haskell 上以开发模式使用 cabal 运行基于 ubuntu 20.04 的构建:

cabal new-run -- exe:live-docs \
  --database-url='postgres://<user>:<password>@<host>:<port>/<dbname>' \
  serve --enable-admin --admin-assets-dir=../admin/static

保持 Cabal 会话在后台工作(保持活动)以供生产使用的最佳做法是什么?

我徒劳地查看了 Cabal 文档。

解决方法

如果目标是避免 cabal 的输出(如您的评论中所述),您有两个快速选择:

  1. 使用 -v0 让它不输出任何东西。如果构建程序失败,它仍然会产生输出。

    cabal run -v0 live-docs -- --db etc
    
  2. 使用 cabal 构建,并可选择将其复制到中央某处,然后……运行您的程序。这是大多数人所做的。构建和运行:

    cabal build live-docs # this produces output and is done once
    
    # the next three are essentially equivalent options. you do one of them each
    # time you want to start your program
    `cabal list-bin live-docs` --db etc # OR
    cabal exec live-docs -- --db etc # OR
    ./dist-newstyle/<poke around a bit>/live-docs --db etc
    

    在中央某处构建和复制:

    cabal install exe:live-docs # done once,produces output
    
    live-docs --db etc # each time you want to start your program