AWS Amplify 部署 Hugo 项目失败报错

Amplify 自动部署 Hugo 项目在构建前端环节失败,报错某个模板时解析失败。类似: [WARNING]: Error: add site dependencies: load resources: loading templates: ".../layouts/partials/meta/author.html:9:1": parse failed: template: partials/meta/author.html:9: unclosed action [ERROR]: !!! Build failed [ERROR]: !!! Non-Zero Exit Code detected 首先的确是模板文件有语

JS 字符串数组的连接 array.join

使用 Array.prototype.join() 以下内容参考 MDN web docs join() 方法将数组中所有元素成一个新的字符串并返回。默认使用逗号作为分隔符或使用指定的分隔字符。 语法: Array.join( ) Array.join(separator) 举例: // Code copied from

Python 执行命令行程序并返回结果

使用 pexpect 库比较省心,使用方便。也不像使用 subprocess 会出现很多问题。 代码: import pexpect def execute_cli_command(cmd: str) -> str: """return stdout:str""" (command_output, exitstatus) = pexpect.run(cmd, withexitstatus=1) command_output = command_output.decode("utf-8") if exitstatus != 0: raise Exception(exitstatus, command_output) return command_output

macOS 如何关闭自启动的后台服务进程

删除如下三个目录中的 .plist 文件,或转移到一个备份文件夹里。 ~/Library/LaunchAgents/ ~/Library/LaunchAgents/ ~/Library/LaunchDaemons/ Quote from ravbug.com: OS to automatically run and re-launch headless background processes. There are at minimum three such folders on macOS. They are: /Library/LaunchAgents, ~/Library/LaunchAgents/, and /Library/LaunchDaemons

Python 删除文件夹

pathlib.Path.unlink() removes a file or symbolic link. 删除单个文件或文件符号链接 os.rmdir() 或 pathlib.Path.rmdir() removes an empty directory. 删除一个空文件夹 os.removedirs() remove recursive empty directories 删除多层的空文件夹 shutil.rmtree() deletes a directory and all its contents. 删除文件夹,包括其中所有子