小编stm*_*stm的帖子

如何在 GitHub Actions 表达式语法中引用上下文值?

我想在env:GitHub Action的部分设置一个环境变量,并使用GitHub Actions上下文和表达式语法。我试过这个:

jobs:
  build:
    runs-on: ubuntu-latest

    env:
      MYVAR: ${{ format('{0}:{1}', ${{ env.PATH }}, ${{ env.HOME }} ) }}

    steps:
    - name: Check environment
      run: echo $MYVAR
Run Code Online (Sandbox Code Playgroud)

这会导致错误消息:

### ERRORED 10:45:52Z

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/main.yml (Line: 10, Col: 14): Unexpected symbol: '${{'. Located at position 19 within expression: format('{0}:{1}', ${{ env.PATH
Run Code Online (Sandbox Code Playgroud)

此语法:

    env:
      MYVAR: ${{ format('{0}:{1}', {{ env.PATH }}, {{ env.HOME }} ) }}
Run Code Online (Sandbox Code Playgroud)

导致错误:

### …
Run Code Online (Sandbox Code Playgroud)

github-actions

9
推荐指数
2
解决办法
4088
查看次数

为什么在线程中使用system()时,多线程C程序在Mac OS X上强制使用单个CPU?

我在Linux和Mac OS X之间使用pthreads的程序行为遇到了奇怪的差异.

考虑以下可以使用"gcc -pthread -o threadtest threadtest.c"编译的程序:

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>

static
void *worker(void *t)
{
    int i = *(int *)t;

    printf("Thread %d started\n", i);
    system("sleep 1");

    printf("Thread %d ends\n", i);
    return (void *) 0;
}

int main()
{
#define N_WORKERS   4

    pthread_t       workers[N_WORKERS];
    int                 args[N_WORKERS];
    int         i;

    for (i = 0; i < N_WORKERS; ++i)
    {
        args[i] = i;
        pthread_create(&workers[i], NULL, worker, args + i);
    }

    for (i = 0; i < N_WORKERS; ++i)
    {
        pthread_join(workers[i], …
Run Code Online (Sandbox Code Playgroud)

c c++ linux macos multithreading

6
推荐指数
1
解决办法
558
查看次数

将 PDF 与 PDF-LIB 合并

我正在尝试复制合并 2 个 pdf 文件的官方示例,但我想让用户上传两个文件,而不是硬编码文件名。当文件名被硬编码时(参见 url2),该代码可以很好地工作,但是当尝试从输入标记检索文件名时,该代码不起作用。我究竟做错了什么?

async function copyPages() {
    // Fetch first existing PDF document
    const url1 = document.getElementById('file1').file[0].name
    //const url1 = 'Patient_Card.pdf'
    const doc1 = await fetch(url1).then(res => res.arrayBuffer())

    // Fetch second existing PDF document
    const url2 = 'Patient_Card.pdf'
    const doc2 = await fetch(url2).then(res => res.arrayBuffer())

    // Load a PDFDocument from each of the existing PDFs
    const pdf1 = await PDFDocument.load(doc1)
    const pdf2 = await PDFDocument.load(doc2)

    // Create a new PDFDocument
    const mergedPdf = await PDFDocument.create();

    const copiedPagesA …
Run Code Online (Sandbox Code Playgroud)

javascript pdf

4
推荐指数
1
解决办法
8863
查看次数

标签 统计

c ×1

c++ ×1

github-actions ×1

javascript ×1

linux ×1

macos ×1

multithreading ×1

pdf ×1