小编Viv*_*vek的帖子

Github 操作 - /bin/sh: 1: jest: not found

使用 Github 操作发布 npm 包,它可以正常工作并运行 jest 测试用例而不会出错。所以我决定添加 yarn 缓存来优化构建时间并且缓存过程有效,但是 jest 失败并出现以下错误。

$ jest --config=jest.config.js
/bin/sh: 1: jest: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 127.
Run Code Online (Sandbox Code Playgroud)

这是我的 yml

name: NPM Publish
on:
  push:
    branches: 
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Get yarn cache directory
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)" …
Run Code Online (Sandbox Code Playgroud)

github yarnpkg github-actions

9
推荐指数
1
解决办法
1729
查看次数

虚拟地址空间

我已经开始了解虚拟地址空间(VAS),我有几个问题:

  1. 根据架构(32 位和 64 位),为每个进程创建多少 VAS?
  2. 每个进程的VAS都是在硬盘上创建的吗?如果是这样,如果空间不足怎么办?
  3. VAS 和虚拟内存 (VM) 有什么区别?

linux memory-management process virtual-memory virtual-address-space

6
推荐指数
2
解决办法
3732
查看次数

C++ 将字符串转换为int

使用stoi()方法将字符串转换为int,但即使有字母,它也会转换为int。

string str1 = "45";
string str2 = "31337 test"; 

int myint1 = stoi(str1); // 45
int myint2 = stoi(str2); // 31337
Run Code Online (Sandbox Code Playgroud)

str2 被转换为 int,但我不想要这种转换,因为它有字母表。是否有任何方法可以捕获或阻止这种转换。

c++ c++11

2
推荐指数
1
解决办法
4353
查看次数

copy_to_user() 不断地打印消息

我正在学习“Linux 设备驱动程序”。我创建了一个名为char_device. 当我从设备读取数据时,它不断将消息打印到终端,使机器无限崩溃。

驱动中读操作的源码:

static ssize_t my_read(struct file *my_file, char __user *buf, size_t len, loff_t *off) {
    uint8_t *message = "Hello from the kernel world!\n";
    size_t datalen = strlen(message);
    
    if(len > datalen) {
        len = datalen;
    }
    printk(KERN_INFO "Char driver: Read");
    if(copy_to_user(buf, message, len)) {
        return -EFAULT;
    }

    return len;
}
Run Code Online (Sandbox Code Playgroud)

用于读取设备的用户空间命令:

cat /dev/char_device
Run Code Online (Sandbox Code Playgroud)

驱动程序不断打印“来自内核世界的你好!” 到终端的消息。

c linux linux-device-driver linux-kernel printk

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